﻿/**
* jQuery Twi.Dialog plugin
* @author: feitianxinhong  http://xuzhihong1987.blog.163.com/
* @version 1.0
* @create date:2013-09-05
* @copyright (c) 2013 feitianxinhong/tyingsoft/twilight  http://www.tyingsoft.com
* @example Visit 
*/
(function () {
	var global = this;
	if (typeof Twi === 'undefined') {
		global.Twi = {};
	}
	Twi.global = global;
	Twi.Dialog = function (config) {
		config = $.extend({
			modal: true,
			height: 300,
			width: 200,
			autoHeight: true,
			html: '',
			contentEl:'',
			showTitle: true,
			title: '标题',
			resizable:true
		}, config);
		this.config = config;
		this.id = "TwiDialog" + Math.floor(100000 * Math.random()); //随机ID     
	}
	Twi.Dialog.prototype.show = function () {
		var html = '<div id="' + this.id + '">';
		html += '<div class="twiDialogBg"></div>';
		html += '<div class="twiDialogCnt"><span type="twiLoadingMaskMsg">' + this.msg + '</span></div>';
		html += '</div>';
		$('body').append(html);
	}
	Twi.Dialog.prototype.close = function () {
		$('#' + this.id).remove();
	}
})();

